package com.monolithiot.sso.common.util;

import java.util.regex.Pattern;

/**
 * 2018/12/15 Create by 郭文梁
 * InterceptorPathUtil
 * 拦截器路径工具类
 *
 * @author 郭文梁
 * @date 2018/12/15
 */
public class InterceptorPathUtil {
    /**
     * 静态资源正则
     */
    private static final Pattern STATIC_RESOURCE_PATTERN =
            Pattern.compile("^/(/|(\\w*))*\\.(html|css|js|jpg|png|gif|bmp|map)$");

    /**
     * 判断访问的路径是否是静态资源
     *
     * @param resourcePath 资源路径
     * @return 是否为静态路径
     */
    public static boolean isStaticResource(String resourcePath) {
        return resourcePath != null && STATIC_RESOURCE_PATTERN.matcher(resourcePath).find();
    }
}
